<template>
    <div>
        <van-tabs v-model="active" color="rgb(25,137,250)" @click="onClick">
            <van-tab title="全部订单">
                <order-list :orderList="orderList"></order-list>
            </van-tab>
            <van-tab title="待评价">
                <order-list :orderList="orderList" :type="1"></order-list>
            </van-tab>
            <van-tab title="退款">
                <order-list :orderList="orderList" :type="2"></order-list>
            </van-tab>
        </van-tabs>
    </div>
</template>

<script>
import order from '@/api/order'

import OrderList from '@/components/order/OrderList.vue';

export default {
    components: {
        OrderList,
    },
    data() {
        return {
            active: 0,
            orderList: [],
            page: {
                current: 1,
                pages: 1,
            }
        };
    },
    created() {
        this.getOrder(1)
    },
    methods: {
        getOrder(current) {
            let data = {
                current
            }
            order.getOrder(data)
                .then(res => {
                    if (res.code == 200) {
                        this.orderList = res.data.orderList.records
                    } else {

                    }
                })
        },
        onClick(name) {
            this.getOrder(name)
        },
    }
};
</script>